#include "somb_lock.h"

void somb_spinlock_init(somb_spinlock_t *lock) {
       atomic_init(&lock->lock, 0);
}

void somb_spinlock_acquire(somb_spinlock_t *lock) {
   while (atomic_exchange(&lock->lock, 1)) {
      // Spin until the lock is acquired
   }
}

void somb_spinlock_release(somb_spinlock_t *lock) {
   atomic_store(&lock->lock, 0);
}


